package com.cn.mapper;

import com.cn.pojo.WordWL;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface WangLuWordMapper {

    //@Select("SELECT w.id, w.english_word AS word, w.us_phonetic AS usPhonetic, w.us_voice AS usVoice, w.uk_phonetic AS ukPhonetic, w.uk_voice AS ukVoice, w.wang_lu_meaning AS wangLuMeaning, e.error_count AS errorCount FROM WangLuWords w JOIN word_test_errors e ON w.id = e.word_id ORDER BY e.error_count DESC LIMIT #{pageSize} OFFSET #{offset}")
    //List<WordWL> getPaginatedErrorWords(@Param("pageSize") int pageSize, @Param("offset") int offset);

    //@Select("SELECT COUNT(*) FROM WangLuWords w JOIN word_test_errors e ON w.id = e.word_id")
    //int getErrorWordsCount();

    @Select("SELECT w.id, w.english_word AS word, w.us_phonetic AS usPhonetic, w.us_voice AS usVoice, w.uk_phonetic AS ukPhonetic, w.uk_voice AS ukVoice, w.you_dao_meaning AS youDaoMeaning, w.wang_lu_meaning AS wangLuMeaning,w.wang_lu_chapter As wangLuChapter, w.remark AS remark, e.error_count AS errorCount FROM WangLuWords w JOIN word_test_errors e ON w.id = e.word_id ORDER BY e.error_count DESC LIMIT #{limit} OFFSET #{offset}")
    //@Results(id = "wangLuWordResultMap", value = {
    //        @Result(property = "word", column = "word"),
    //        @Result(property = "usPhonetic", column = "usPhonetic"),
    //        @Result(property = "usVoice", column = "usVoice"),
    //        @Result(property = "ukPhonetic", column = "ukPhonetic"),
    //        @Result(property = "ukVoice", column = "ukVoice"),
    //        @Result(property = "youDaoMeaning", column = "youDaoMeaning"),
    //        @Result(property = "wangLuMeaning", column = "wangLuMeaning"),
    //        @Result(property = "wangLuChapter", column = "wangLuChapter"),
    //        @Result(property = "remark", column = "remark"),
    //        @Result(property = "errorCount", column = "errorCount")
    //})
    List<WordWL> getPaginatedErrorWords(@Param("limit") int limit, @Param("offset") int offset);


}
